<!DOCTYPE html>
<html lang="zh">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title></title>
    <style>
        body {
            font-family: Arial, sans-serif;
            margin: 0;
            padding: 0;
            background-color: rgb(237, 237, 237);
            line-height: 100%;
        }
        .container {
            background-color: #FFFF;
            margin-bottom: 10px;
            padding: 10px 5%;
        }
        .profile {
            display: flex;
            align-items: center;
        }
        .profile img {
            border-radius: 15px;
            width: 60px;
            height: 60px;
            margin-right: 15px;
        }
        .divider {
            text-align: center;   
            border-bottom: 1px solid #f3f3f3;
            width: 95%;
            margin: 10px auto;
        }
        .tags {
            color: black;
            margin-left: 2.5%;
        }
        .signature {
            margin: 10px 0;
        }
        .contacts {
            text-align: center;
            color: #007aff;
            cursor: pointer;
            height: 40px;
            display: flex;
            align-items: center;
            justify-content: center;
        }
        .floating-image {
            display: none;
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background-color: rgba(0, 0, 0, 0.8);
            justify-content: center;
            align-items: center;
            z-index: 1000;
        }
        .floating-image img {
            max-width: 90%;
            max-height: 90%;
            padding-bottom: 110%;
            transition: transform 0.3s ease;
        }
        .other {
            color: rgb(149, 149, 149);
            font-size: 14px;
        }
    </style>
</head>
<body>

    <!-- 第一段 -->
    <div class="container">
        <div class="profile">
            <img src="1.jpg" alt="头像">
            <div class="profile-info">
                <div class="nackname">
                    Jack
                    <img src="you.png" style="width: 15px; height: 15px; margin-left: 5px;">
                </div>
                <div class="other">微信号：zwl2114244594</div>
                <div class="other">地区：中国澳门 大堂区</div>
            </div>
        </div>
        <div class="divider"></div>
        <div style="display: flex;">
            <div class="tags" style="width: 50%;">备注和标签</div>
            <div style="text-align: right; width: 50%; color: rgb(179, 179, 179); margin-right: 2.5%;">></div>
        </div>
    </div>

    <!-- 第二段 -->
    <div class="container">
        <div class="signature">
            <div style="display: flex;">
                <div style="margin-left: 2.5%;">个性签名</div>
                <div style="color: rgb(186, 186, 186); margin-left: 20px;">这是我的个性签名。</div>
                <img src="test.jpg" style="width: 15px; height: 10%; margin-left: 10px; cursor: pointer;" onclick="showImage(this.src)">
            </div>
            <div class="divider"></div>
            <div style="display: flex;">
                <div style="margin-left: 2.5%;">来源</div>
                <div style="margin-left: 50px;">微信扫一扫</div>
            </div>
        </div>
    </div>

    <!-- 第三段 -->
    <div class="container">
        <div class="contacts">
            添加到通讯录
        </div>
    </div>

    <!-- 浮动图片 -->
    <div class="floating-image" id="floatingImage">
        <img id="floatingImageContent" />
    </div>

    <script>
        let scale = 1;

        function showImage(src) {
            const floatingImage = document.getElementById('floatingImage');
            const floatingImageContent = document.getElementById('floatingImageContent');

            floatingImage.style.display = 'flex';
            floatingImage.style.backgroundColor = 'rgba(0, 0, 0, 0)';
            floatingImageContent.src = src;
            scale = 0.3; // 初始缩放10%
            floatingImageContent.style.transform = `scale(${scale})`; // 设置初始缩放
        }

        function hideImage() {
            const floatingImage = document.getElementById('floatingImage');
            floatingImage.style.display = 'none';
            scale = 1; // 重置缩放比例
        }

        function scaleImage() {
            scale += 0.1; // 每次点击增加10%
            const floatingImageContent = document.getElementById('floatingImageContent');
            floatingImageContent.style.transform = `scale(${scale})`;
        }

        document.getElementById('floatingImage').addEventListener('click', function (event) {
            // 如果点击的是图片，则放大，否则隐藏
            if (event.target.id === 'floatingImageContent') {
                scaleImage();
            } else {
                hideImage();
            }
        });

        // 长按隐藏图片
        let pressTimer;
        const floatingImage = document.getElementById('floatingImage');

        floatingImage.addEventListener('touchstart', function () {
            pressTimer = setTimeout(hideImage, 200); // 500ms长按
        });

        floatingImage.addEventListener('touchend', function () {
            clearTimeout(pressTimer);
        });
    </script>

</body>
</html>
